<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateSinglePoolTransactionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('single_pool_transactions', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('user_id')->unique()->comment('用户id');
            $table->decimal('amount', 18, 2)->default(0)->comment('交易金额');
            $table->decimal('balance', 18, 2)->default(0)->comment('交易后余额');
            $table->tinyInteger('change_type')->default(1)->comment('1-增加, 2-减少');
            $table->string('describe')->comment('描述');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('single_pool_transactions');
    }
}
